|
|
|
| Table 11.1 Equations for the Curves in Figure 11.2 | | PROGRAM | X(T) | Y(T) | VALUES OF T | | Spiral | 7 * t2/350 * Cos(t) | 7 * t2/350 * Sin(t) | 0 <= t<=6 * p | | Bditch | 2000 * Sin(4*t) | 2000 * Sin(5*t) | 0 <= t<=2 * p | | Cycloid | 2000 * (27 * Cos(t)
+ 15 * Cos(t * 20/7)) / 42 | 2000 * (27 * Sin(t)
+ 15 * Sin(t * 20/7)) / 42 | 0 <= t<=14 * p |
|
 |
|
|
|
|
pic.Line -(cx + x_scale * X(t), cy + y_scale * Y(t))
t = t + dt
Loop
pic.Line -(cx + x_scale * X(stop_t), _
cy + y_scale * Y(stop_t))
End Sub |
|
|
|
|
|
|
|
|
Example program Circle2 uses this code to display stretched circles. Enter the scale factors and click the Go button. The program adjusts the circle's radius and center to keep the ellipse in the middle of the picture box. |
|
|
|
|
|
|
|
|
Figure 11.3 shows a circle drawn by the Circle2 program. In this picture, the points have been scaled by a factor of 0.5 in the Y direction, making the circle appear squashed. |
|
|
|
|
|
|
|
|
Another way you can transform a curve is to rotate each of its points. If you want to rotate the points by an angle of q radians, transform the X and Y coordinates of each point like this: |
|
|
|
 |
|
|
|
|
new X(t) = X(t) * Cos(q) - Y(t) * Sin(q)
new Y(t) = X(t) * Sin(q) + Y(t) * Cos(q) |
|
|
|
|
|
|
|
|
Figure 11.3
A circle scaled by a factor of 0.5 in the Y direction. |
|
|
|
|
|